<!doctype html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <h1>111</h1>
    <h1>111</h1>
    <h1>111</h1>
    <h1>111</h1>
    <h1>111</h1>
    <h1>111</h1>
    <h1>111</h1>
    <h1>111</h1>
    <h1>111</h1>
    <h1>111</h1>
    <h1>111</h1>
    <h1>111</h1>
    <h1>111</h1>
    <h1>111</h1>
    <h1>111</h1>
    <h1>111</h1>
    <h1>111</h1>
    <h1>111</h1>
    <h1>111</h1>
    <h1>111</h1>
    <h1>111</h1>
    <h1>111</h1>
    <h1>111</h1>
    <h1>111</h1>
    <h1>111</h1>
    <h1>111</h1>
    <h1>111</h1>
    <h1>111</h1>
    <h1>111</h1>
    <h1>111</h1>
    <h1>111</h1>
    <h1>111</h1>
    <h1>111</h1>
    <h1>111</h1>
    <h1>111</h1>
    <h1>111</h1>
    <h1>111</h1>
    <h1>111</h1>
    <script>
      document.addEventListener("scroll", () => {
        //滚上去的高度
        let scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
        //   网页视口的宽度
        let windowHeight = document.documentElement.clientHeight || document.body.clientHeight;
        //整个页面的高度
        let pageHeight = document.documentElement.scrollHeight || document.body.scrollHeight;
        console.log(scrollTop);
        console.log(windowHeight);
        console.log(pageHeight);
        if (Math.ceil(scrollTop) + windowHeight === pageHeight) {
          console.log("到底了");
        }
      });
    </script>
  </body>
</html>
